#include <p18f4550.h>
#include <delays.h>
#include <xc.h>
#define _XTAL_FREQ 4000000  
void main (void)
{
    ADCON1=15;
    TRISA=1;
    TRISB=0;
    TRISD=0;
    int i=0;
    int anodos[6]= {0x40,0x20,0x10,0x08,0x06,0x02};
    int catodos[6]={0x81,0x7E,0x7E,0x7E,0x7E,0x00};
    while(1)
    {
        while(PORTAbits.RA0==1&&PORTAbits.RA1==1&&PORTAbits.RA2==1&&PORTAbits.RA3==1)
        {
        for(i=0;i<6;i++)
        {
           PORTB=anodos[i];
           PORTD=catodos[i];
           __delay_ms(10);

        }
        }
    }
    return;
}